package xkp.lesson1;

import javax.swing.*;
import java.awt.*;

public class TestFlowLayout extends JFrame {
    public TestFlowLayout() throws HeadlessException {
        this.setTitle("流式布局");
        this.setBounds(400,300,400,300);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //使用的是默认布局管理器 为FlowLayout
        JPanel jPanel = new JPanel();
      /*  FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT);
        jPanel.setLayout(flowLayout);*/
        BorderLayout borderLayout = new BorderLayout();
        jPanel.setLayout(borderLayout);
        JLabel jLabel1 = new JLabel("第一个文本");
   /*     JLabel jLabel2 = new JLabel("第2个文本");
        JLabel jLabel3 = new JLabel("第3个文本");*/
        jPanel.add(jLabel1);
       /* jPanel.add(jLabel2);
        jPanel.add(jLabel3);*/
        this.add(jPanel);
        //this.setVisible(true);
    }

    @Override
    public void setVisible(boolean b) {
        super.setVisible(b);
    }

    public static void main(String[] args) {
        TestFlowLayout testFlowLayout = new TestFlowLayout();
        testFlowLayout.setVisible(true);

    }
}
